
$(function(){
	inti_role(); //初始化页面加载权限组信息；
});
function inti_role(){
	$.ajax({ 
		type : "POST", 
		dataType : "json", 
		url:j_basePath+'roleInfo_getRoleInfo.do', 
		traditional: true,//在struts2下该属性必须有 
		data:{'id':id}, 
		success:function(result){
			if(result){
				var data=eval('(result)');
				$("#roleId").val(data.id);
				$("#roleName").val(data.name);
				$("#description").val(data.description);
			}
		}
	});
}
function submitForm(){
	var roleId=$('#roleId').val();
	var roleName=$('#roleName').val();
	var description=$('#description').val();
	//校验功能
	
	if(roleName == null || roleName == ''){
		alert('权限组编码不能为空！');
		return;
	}
	if(description == null || description == ''){
		alert('权限组名称不能为空！');
		return;
	}
	
	var str = {"frsfRole.id":roleId,
				"frsfRole.name":roleName ,
			   "frsfRole.description":description 
			  };
	$.ajax({ 
		type : "POST", 
		dataType : "json", 
		url:j_basePath + 'toRoleUpdate.do', 
		traditional: true,//在struts2下该属性必须有 
		data:str, 
		success:function(result){
			if(result){
				alert(result.message);
				if(result.opttype == "true"){
					//var frame=$("#roleList_tab")[0];//抓取tab利用tab的ID，tab策略为：jsp简名+“_tab”
					//frame.contentWindow.intialRole(); //刷新tab页面的datagrid
					top.refreshDataGrid();
				  	top.closeDialog(); //关闭弹窗
				}
			}
		}
	});

}
$("#closeMenu").bind("click",function(){
		//window.parent.document.getElementById("employeeIFrame").contentWindow.closeDialog();
		top.closeDialog();
});